package vn.tecviets.thuandt.model.common;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.microsoft.sqlserver.jdbc.SQLServerDataSource;

public class ConnectionProvider {
	public static Connection getConnection() throws ClassNotFoundException, SQLException {
		
		/*
		 * Khai bao cac hang so
		 */
		final String USERNAME = "sa";
		final String PASSWORD = "1234";
		final String SERVERNAME = "localhost";
		final int PORTNUMBER = 1433;
		final String DATABASENAME = "Website";
				
		/*
		 * Nhap cac thong so tao ket noi
		 */
		SQLServerDataSource ds = new SQLServerDataSource();
		ds.setUser(USERNAME);
		ds.setPassword(PASSWORD);
		ds.setServerName(SERVERNAME);
		ds.setPortNumber(PORTNUMBER); 
		ds.setDatabaseName(DATABASENAME);
		Connection con = ds.getConnection();
		return con;	
	}
}
